#define  _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
int main()
{
    int n = 0;
    while (scanf("%d", &n) != EOF)
    {
        if (n == 0)
            break;
        int arr[100] = { 0 }, i = 0, max = 0;
        for (i = 0, max = 0; i < n; i++)
        {
            scanf("%d", &arr[i]);
            if (arr[i] > arr[max])
                max = i;
        }
        printf("%d\n", arr[max]);
    }
    return 0;
}